package ch0001;

import java.awt.Container;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class MyFrame2 extends JFrame {

	JLabel label_name;
	JTextField text_name;
	JButton button1;
	JButton button2;
	JLabel label_sn;
	JTextField text_sn;
	JLabel label_major;
	JTextField text_major;
	JLabel label_class;
	JTextField text_class;
	JLabel label_en_score;
	JTextField text_en_score;
	JLabel label_math_score;
	JTextField text_math_score;

	public MyFrame2() {
		setTitle("作业1");
		setSize(500, 300);
		label_name = new JLabel("姓名");
		text_name = new JTextField(10);
		label_sn = new JLabel("学号");
		text_sn = new JTextField(10);
		label_major = new JLabel("专业");
		text_major = new JTextField(10);
		label_class = new JLabel("班级");
		text_class = new JTextField(10);
		label_en_score = new JLabel("英语成绩");
		text_en_score = new JTextField(10);
		label_math_score = new JLabel("数学成绩");
		text_math_score = new JTextField(10);
		button1 = new JButton("确定");
		button2 = new JButton("取消");

		Container c1 = getContentPane();
		c1.setLayout(new FlowLayout());
		c1.add(label_name);
		c1.add(text_name);
		c1.add(label_sn);
		c1.add(text_sn);
		c1.add(label_major);
		c1.add(text_major);
		c1.add(label_class);
		c1.add(text_class);
		c1.add(label_en_score);
		c1.add(text_en_score);
		c1.add(label_math_score);
		c1.add(text_math_score);
		c1.add(button1);
		c1.add(button2);
		setVisible(true);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MyFrame2 my2 = new MyFrame2();
		my2.show();
		my2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

}

